package com.example.board;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Slf4j
@EnableAsync
@EnableScheduling
@EnableTransactionManagement
@MapperScan("com.example.board.mapper")
@SpringBootApplication
@EnableSwagger2
public class BoardApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext run =
                SpringApplication.run(BoardApplication.class, args);

        Environment env = run.getBean(Environment.class);
        String port = env.getProperty("server.port");
        log.info("link(接口文档):  "+"http://localhost:{}/doc.html",port);
        log.info("link(api导出):   "+"http://localhost:{}/v2/api-docs",port);
    }

}
